Class: LucidBackend

LucidBackend()

Serves as intermediate layer between LucidJS library and React user interface code.

Constructor

new LucidBackend()

Source:

Classes

LucidBackend

Members

canOptimize

Check if renderer is ready to optimize.
Source:

getActivationModifications

Returns activation modification parameters. Experimental.
Source:

getActivationShape

Returns shape of activation tensor of currently selected layer.
Source:

getActivationStats

Returns mean and variance for activations of specified channel.
Source:

getChannel

Returns currently selected channel for 'channel' optimization objective.
Source:

getChannelNumber

Returns number of channels of current layer.
Source:

getClass

Returns current class for 'class' optimization objective.
Source:

getContentImage

Returns current content image.
Source:

getCurrentActivations

Returns activations of current layers' activations as image data.
Source:

getCurrentInput

Returns current input as image data.
Source:

getCurrentInputTensor

Returns current input as tensor.
Source:

getCurrentPrediction

Returns class prediction for current input.
Source:

getImageDataFromTensor

Downloads image data from tensor synchronously.
Source:

getInputParams

Get input parameters from renderer.
Source:

getInputSize

Returns currently selected input size.
Source:

getJitter

Returns current jitter.
Source:

getLastInput

Gets last stored input for comparison view.
Source:

getLastInputShape

Returns shape of last stored input.
Source:

getLayer

Gets currently selected layer.
Source:

getLearningRate

Returns current learning rate.
Source:

getLoadStatus

Get load status from renderer.
Source:

getModel

Get model from renderer.
Source:

getModelInputShape

Returns input shape for current model.
Source:

getModelName

Get model name from renderer.
Source:

getNegative

Get current negative toggle status.
Source:

getNeuron

Returns currently selected neuron for 'neuron' optimization objective.
Source:

getObjectiveType

Get current objective type.
Source:

getShapeForLayer

Returns output shape for specified layer.
Source:

getStyleImage

Returns current style image.
Source:

getStyleImageShape

Returns shape for style image.
Source:

getStyleLayers

Return current style layers for 'style' objective.
Source:

hasCurrentInput

Checks if renderer has input set.
Source:

hasModel

Check if model is loaded.
Source:

isOptimizing

Check if renderer is optimizing.
Source:

resetInput

Resets input, can be called while optimizing.
Source:

setActivationModifications

Sets activation modification parameters. Experimental.
Source:

setChannel

Sets channel index for 'channel' optimization objective.
Source:

setClass

Sets class for 'class' optimization objective.
Source:

setClassObjFrequencyLevelWeights

Sets weights for individual pyramid layers when optimizing for 'class' objective. Experimental.
Source:

setContentImage

Set content image for 'style' objective.
Source:

setFeatureMapLayer

Sets layer to get feature map tensors for.
Source:

setInputParams

Sets input parameters. Not possible while optimizing.
Source:

setJitter

Set jitter amount in pixels.
Source:

setLayer

Sets selected layer. Not possible while optimizing.
Source:

setLearningRate

Sets learning rate for optimizer.
Source:

setNegative

Set negative toggle to invert loss function.
Source:

setNeuron

Sets neuron position for 'neuron' optimization objective.
Source:

setObjectiveType

Set optimization objective type, can be called while optimizing.
Source:

setStyleImage

Set style image for 'style' objective.
Source:

setStyleLayers

Set style layers for 'style' objective.
Source:

startOptimization

Starts optimization loop.
Source:

stopOptimization

Stops optimization loop.
Source:

storeCurrentInput

Stores current input for comparison view.
Source:

validateOptimizationInput

Validates optimization input.
Source:

Methods

deprocessImage(x)

Get image data in 0-255 range from tensor.
Parameters:
Name Type Description
x * image tensor
Source:

isOptimizing()

Check if renderer is optimizing.
Source:

(async) loadModel(modelPath, progressCb)

Loads model from server directory.
Parameters:
Name Type Description
modelPath *
progressCb * progress callback, can be used for status bar
Source:

(async) loadModelFromFile(topoFile, weightFiles, progressCb)

Loads model from client-side file
Parameters:
Name Type Description
topoFile *
weightFiles *
progressCb * progress callback, can be used for status bar
Source: